simplify code using an inverse dictionary in python

welcome to shbcf.ru